import sqlite3

conn = sqlite3.connect('db.sqlite3')
cursor = conn.cursor()

# 查看所有表
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cursor.fetchall()
print('所有表:', [t[0] for t in tables])

# 查看公告表数据
try:
    # 先查看announcements表结构
    cursor.execute("PRAGMA table_info(announcements)")
    columns = cursor.fetchall()
    print('\nannouncements表结构:')
    for col in columns:
        print(f'  {col[1]} ({col[2]})')
    
    cursor.execute("SELECT * FROM announcements LIMIT 10")
    announcements = cursor.fetchall()
    print('\n公告数据:')
    for ann in announcements:
        print(f'数据: {ann}')
    
    # 检查是否存在ID为180006的公告
    cursor.execute("SELECT COUNT(*) FROM announcements WHERE announcement_id = 180006")
    exists = cursor.fetchone()[0]
    print(f'\n公告180006存在: {exists > 0}')
except Exception as e:
    print(f'查询公告表失败: {e}')

conn.close()